using AndyPike.Commons.Persistence;
using AndyPike.Snowflake.Core.Messages;
using AndyPike.Snowflake.Core.Services;
using AndyPike.Snowflake.Entities;
using NUnit.Framework;
using Rhino.Mocks;

namespace AndyPike.Snowflake.Core.Tests.Unit.Services.AccountServiceFixtures
{
    public class AccountServiceFixtureBase
    {
        protected MockRepository mockery;
        protected IAccountService service;
        protected IRepository<Account> accountRepository;

        [SetUp]
        public void SetUp()
        {
            mockery = new MockRepository();
            accountRepository = mockery.DynamicMock<IRepository<Account>>();

            //Using a property for the mapper so I can keep the constructor clean and allow the implementation 
            //to be change and allow mocking. This class is unlikely to change and implementation should have 
            //a default set internally.
            service = new AccountService(accountRepository)
            {
                RegistrationToAccountMapper = mockery.DynamicMock<IMessageToEntityMapper<RegistrationMessage, Account>>(),
                AccountToAccountInfoMessageMapper = mockery.DynamicMock<IEntityToMessageMapper<Account, AccountInfoMessage>>()
            };
        }
    }
}